package com.gxa.logistics.service.impl;

import com.github.pagehelper.PageHelper;
import com.gxa.logistics.common.base.PageWrapperDTO;
import com.gxa.logistics.common.base.RespResult;
import com.gxa.logistics.common.util.PageResultUtil;
import com.gxa.logistics.domain.dto.PlanRecordDTO;
import com.gxa.logistics.domain.vo.BillVO;
import com.gxa.logistics.domain.vo.PlanRecordVO;
import com.gxa.logistics.mapper.PlanRecordMapper;
import com.gxa.logistics.service.PlanRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PlanRecordServiceImpl implements PlanRecordService {
    @Autowired
    PlanRecordMapper planRecordMapper;
    @Override
    public RespResult<PageWrapperDTO<PlanRecordVO>> selectPlanRecord(PlanRecordDTO planRecordDTO) {
        PageHelper.startPage(planRecordDTO.getPageNo(), planRecordDTO.getPageSize());
        PageWrapperDTO<PlanRecordVO> pageWrapperDTO = new PageWrapperDTO<>();
        List<PlanRecordVO> planRecordVOS =planRecordMapper.selectPlanRecord(planRecordDTO);
        PageResultUtil.setPageResult(planRecordVOS,pageWrapperDTO);
        return RespResult.success(pageWrapperDTO);
    }

    @Override
    public List<String> selectAllPlanType() {
        return planRecordMapper.selectAllPlanType();
    }

    @Override
    public void updatePlanById(Integer planId) {
        planRecordMapper.updatePlanById(planId);
    }
}
